import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/components/back_btn_icon.dart';
import 'package:share_fit/app/controllers/space/service/health_logic.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/generated/locales.g.dart';

class AppleHealthPage extends StatelessWidget {

  final logic = Get.put(HealthLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(LocaleKeys.service_connect_health.ts, ),
        centerTitle: true,
        leading: BackBtnIcon(onTap: () => Get.back()),
      ),
      body: Column(
        children: [
          Container(
            width: 1.sw,
            padding: EdgeInsets.only(left: 38.w, right: 38.w, top: 100.h),
              child: Text(LocaleKeys.service_health_content.ts, style: TextStyle(fontSize: 45.sp, color: ColorConst.btnFontColor),)
          ),
          Container(
              width: 820.w,
              height: 832.w,
              alignment: Alignment.center,
              padding: EdgeInsets.only(top: 144.h),
              child: Image.asset('assets/images/device/device_qrcode.png', fit: BoxFit.fill,)
          ),
          Container(
            width: 1.sw,
            height: 135.h,
            margin: EdgeInsets.fromLTRB(43.w, 244.h, 43.w, 0),
            child: ElevatedButton(
              onPressed: () {
                logic.authorize();
              },
              style: ButtonStyle(
                  backgroundColor: MaterialStateProperty.all(ColorConst.activeColor),
                  shape: MaterialStateProperty.all(RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(10)
                  ))
              ),
              child: Text(LocaleKeys.service_connect.ts, style: TextStyle(fontSize: 48.sp, color: Colors.white, ),),
            ),
          )
        ],
      ),
    );
  }
}